package com.example.arithmeticleetcode.leetcode.July;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-07-03 17:31
 **/
public class Demo02 {

    public static void main(String[] args) {
        int[][] A = {{1, 1, 0}, {1, 0, 1}, {0, 0, 0}};
        System.out.println(flipAndInvertImage(A));
    }

    public static int[][] flipAndInvertImage(int[][] A) {
        int[][] result = new int[A.length][];
        for (int i = 0, len = A.length; i < len; i++) {
            int[] arr = new int[len];
            for (int j = 0, len2 = A[i].length; j < len2; j++) {
                arr[j] = A[i][len2 - 1 - j] == 0 ? 1 : 0;
            }
            result[i] = arr;
        }
        return result;
    }
}
